home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 1999 November / SGI IRIX 6.5 Applications 1999 November.iso / dev / insight_dev.idb / usr / share / Insight / bin / valid_helpmaps.z / valid_helpmaps
Encoding:
Text File  |  1998-10-28  |  889 b   |  41 lines

  1. #!/bin/sh
  2. #
  3. SGML=$1
  4. if [ "$SGML" = "" ] ; then
  5.         echo "Usage: valid_helpmaps sgml-file directory";
  6.         exit;
  7. fi
  8. DIR=$2
  9. if [ "$DIR" = "" ] ; then
  10.         echo "Usage: valid_helpmaps sgml-file directory";
  11.         exit;
  12. fi
  13.  
  14. # check to see that SGML file exists
  15. if [ ! -f $SGML ] ; then
  16.         echo "Usage: valid_helpmaps sgml-file directory";
  17.         echo "       SGML file non-existant";
  18.         exit;
  19. fi
  20.  
  21. if [ "$TMPDIR" = "" ] ; then
  22.         TMPDIR=/usr/tmp;
  23. fi
  24.  
  25. TMPFILE1=$TMPDIR/helptopics.tmp.$$
  26. TMPFILE2=$TMPDIR/helpgrep.tmp.$$
  27. VALID_HELPMAPS=""
  28.  
  29. for helpmap in $DIR/* ; do
  30.   awk -F\; '{ print $5 }' $helpmap | sort -u > $TMPFILE1
  31.   for helptopic in `cat $TMPFILE1`; do
  32.     grep "HELPID = \"${helptopic}\"" $SGML > $TMPFILE2
  33.     if [ -s $TMPFILE2 ]; then
  34.     VALID_HELPMAPS="$VALID_HELPMAPS $helpmap"
  35.     break
  36.     fi
  37.   done
  38. done
  39. echo $VALID_HELPMAPS
  40. /bin/rm -f $TMPFILE1 $TMPFILE2
  41.